<extend name="public:base"/>

<block name="left">
    <div class="mark_bar cl">
        <a href="javascript:history.back(-1);" class="goback fl"><i class="iconfont">&#xe600;</i></a>
        <p>注册</p>

    </div>
</block>

<block name="main">
    <div class="container">

        <form action="{:url('user/passport/register')}" method="post" id="form">

            <div class="form">
                <div class="input_form">
                    <div class="input_form_bar">
                        <p>手机号码</p>
                        <input placeholder="请输入手机号码" name="phone" id="phone" size="11" maxlength="11" type="tel" autocomplete="off"/>
                        <div class="cl"></div>
                    </div>
                    <div class="input_form_bar">
                        <p>图形验证码</p>
                        <input placeholder="图形验证码" name="verify" id="verify" class="input_t" value="" size="4" maxlength="4" autocomplete="off" type="text"/>
                        <img src="{:captcha_src()}" class="verifyimg">
                        <div class="cl"></div>
                    </div>
                    <div class="input_form_bar">
                        <p>短信验证码</p>
                        <input type="hidden" id="sendcodeurl" value="{:url('uc/sign/reg_sms')}"/>
                        <input placeholder="短信验证码" name="scode" id="scode" class="input_t" value="" size="6"
                               maxlength="6" autocomplete="off" type="tel"/>
                        <a href="javascript:void(0);" class="send_btm" id="btnSendMsg" onclick="isSendbtm();">获取验证码</a>
                        <div class="cl"></div>
                    </div>
                    <div class="input_form_bar">
                        <p>登录密码</p>
                        <input name="password" maxlength="16" id="password" placeholder="8-16位包含字母和数字密码" type="password" autocomplete="off"/>
                        <i class="iconfont passeye">&#xe626;</i>
                        <div class="cl"></div>
                    </div>
                    <div class="input_form_bar">
                        <p>推荐码</p>
                        <notempty name="invite">
                            <input name="exp_phone" id="exp_phone" maxlength="11" value="{$invite}" readonly="readonly" type="tel"/>
                            <else/>
                            <input name="exp_phone" id="exp_phone" maxlength="11" value="" placeholder="请填写推荐人的手机号（选填）" type="tel" autocomplete="off"/>
                        </notempty>
                        <div class="cl"></div>
                    </div>
                </div>
                <div class="wrap">
                    <!--<div class="a999 small tc">
                        <input type="checkbox" name="agree" id="agree" value="0" autocomplete="off" />我已阅读并同意
                        <a href="{:url('index/agreement/service')}" class="af60">《微金在线用户服务协议》</a>
                        <a href="{:url('index/agreement/risk')}" class="af60" style="display: inline-block;">《微金在线风险提示告知书》</a>
                    </div>-->
                    <div class="pt1"><input class="submit" type="submit" id="submitBtn" value="确认注册"/></div>
                </div>
                <div class="pt1 tc small a999">
                    已有帐号，<a href="{:url('user/passport/login')}" class="af60">马上登录</a>
                </div>
            </div>
        </form>
    </div>
</block>

<block name="menu"></block>

<block name="js">

    <script type="text/javascript" src="__JS__/check.js?v={:config('app_ver')}"></script>
    <script type="text/javascript">
        $(function () {

            var tab = ".registerTab", userType = "#userType", agree = "#agree", borrow = "#isBorrow" , exp_phone = "#exp_phone";

            $(tab).find("a").click(function () {
                $(this).addClass("on").siblings("a").removeClass("on");
                $(userType).val($(this).index() === 0 ? 1 : 2);
            });

            $("#changeUserType").click(function () {
                var type = parseInt($(this).attr("data-type"));
                if (type === 1) {
                    $("#fenxian").hide();
                    $(tab).removeClass("hide");
                    $(this).attr("data-type", 2).html("投资用户");
                    $("#exp_phone").prop("disabled" , true).parents(".input_form_bar").hide();
                } else {
                    $("#fenxian").show();
                    $(tab).addClass("hide").find("a").removeClass("on").eq(0).addClass("on");
                    $(this).attr("data-type", 1).html("借款用户");
                    $("#exp_phone").prop("disabled" , false).parents(".input_form_bar").show();
                }
                $(userType).val(1);
                $(borrow).val(type === 1 ? 1 : 0);
            });

            clickAgree();

            setPartnerInfo();

            $("#form").submit(function () {
                if (!checkPhone()) return false;
                if (!checkVerify()) return false;
                if (!checkPhonecode()) return false;
                if (!checkPassword()) return false;
                if(parseInt($(agree).val()) !== 1){
                    wjtips("您还未阅读并同意相关协议");
                    return false;
                }
                return ajax_post($(this), '', '', '', '', 2);
            });

        });
    </script>

</block>